Page({
  onLoad() {
    this.getAnnouncements()
  },
  data: {
    //公告列表
    isMessage: []
  },
  // 获取公告列表
  async getAnnouncements() {
    const res = await wx.http.get('/announcement')
    // if (res.code !== 10000) return
    // 自定义修改数组
    let list = []
    for (let i = 0; i < res.data.data.length; i++) {
      const newArray = res.data.data.filter(item => +item.id === list.length + 1)
      list.push(...newArray)
    }
    // console.log(list);
    this.setData({
      isMessage: list
    })
  }
})